<?php


namespace app\store\controller;

use library\Controller;
use library\tools\Data;
use think\Db;

/**
 * 积分日志管理
 * Class Member
 * @package app\store\controller
 */
class ScoreLog extends Controller
{
    /**
     * 绑定数据表
     * @var string
     */
    protected $table = 'StoreMemberScoreLog';

    /**
     * 积分日志
     * @auth true
     * @menu true
     * @throws \think\Exception
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     * @throws \think\exception\PDOException
     */
    public function index()
    {
        $this->title = '积分日志';

        $order = "id desc";

        $query = $this->_query($this->table)->equal("user_id");
        $query->dateBetween('create_at')->order($order)->page();

    }

    /**
     * 数据列表处理
     * @param array $data
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     */
    protected function _index_page_filter(&$data)
    {
        foreach ($data as $k =>&$v){
            $v['user'] = Db::table("store_member")->where(["id"=>$v['user_id']])->find();
        }
    }
}